package com.itheima.job4;

import java.io.*;
import java.net.Socket;

public class Client {
    public static void main(String[] args) throws IOException {
        try{
        Socket client = new Socket("127.0.0.1", 6666);
            InputStream is = client.getInputStream();
            OutputStream os = new FileOutputStream("E:test/imageInfo/image2.png");
            byte[] buf = new byte[1024];
            int len;
            while ((len = is.read(buf))!=-1){
                os.write(buf,0,len);
            }
            os.close();
        client.close();//释放连接资源
    } catch (
    IOException e) {
        throw new RuntimeException(e);
    }
    }
}
